package dome2;
import java.util.Scanner;
public class Text {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        hanIo(n,'A','B','C');
    }

    public static void move(char pos1,char pos3) {
        System.out.print(" " + pos1 + "->" + pos3 + " ");
    }
    public static void hanIo(int n,char pos1,char pos2,char pos3) {
        if(n == 1) {
            move(pos1,pos3);
        }else {
            hanIo(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            hanIo(n-1,pos2,pos1,pos3);
        }
    }
}